package com.lyf;

import com.lyf.beans.entity.Person;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @AUTHOR LYF
 * @DATE 2022/5/12
 * @VERSION 1.0
 * @DESC
 */
public class MainApp {
    public static void main(String[] args) {

//        ApplicationContext
//                context = new ClassPathXmlApplicationContext("/bean/bean.xml");
//        HelloSpring helloSpring = (HelloSpring) context.getBean("HelloSpring");
//        helloSpring.printName();

        ApplicationContext
                context1 = new AnnotationConfigApplicationContext("/com/lyf");
//        HelloSpring helloSpring1 = (HelloSpring) context1.getBean("helloSpring");
//        helloSpring1.printName();
        Person person = (Person) context1.getBean("person");
        System.out.println(person.getName());
        String[] names = context1.getBeanDefinitionNames();
        for(String str:names){
            System.out.println(str);
        }

    }
}
